<?php
namespace app\index\controller;
use think\Request;  
use think\controller\Rest; 
class News extends Rest{
	public function read($id){  
        $model = model('News');   
        $data=$model->where('id', $id)->find();// 查询单个数据  
        return json($data);  
    }
    public function readAll(){
        $start=input('param.start')!=NULL?input('param.start'):0;
        $count=input('param.count')!=NULL?input('param.count'):10;
        $model = model('News');   
        $data=$model->limit($start,$count)->select();
        foreach ($data as $key => $value) {
            $data[$key]['content'] = strip_tags(htmlspecialchars_decode($value['content']));
            $data[$key]['content']=DeleteHtml($data[$key]['content']);
            $data[$key]['content'] = mb_substr($data[$key]['content'], 0, 50,"utf-8");
        }
        return json($data);  
    }
}